package is.ejs.bahamut;

import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
import java.security.SecureRandom;

public class StatisticsActivity extends Activity {
	public void onCreate(Bundle savedInstanceState) {
	       super.onCreate(savedInstanceState);
	       
			int numberOfNumbers = 1;
			int dieSize = 20;
			double expValue = (((double)dieSize+1)/2)*(double)numberOfNumbers;
	       
			SecureRandom stream = new SecureRandom();
			int randomInt = stream.nextInt(dieSize)+1;

	       TextView tv = new TextView(this);
			
			if ((double)randomInt > expValue){
				double percentage = ((double)randomInt/expValue - 1)*100;
				tv.setText("You rolled " + randomInt + ", which is " + percentage + "% higher than the expected value.");
			} else {
				double percentage = ((double)randomInt/expValue)*100;
				tv.setText("You rolled " + randomInt + ", which is " + percentage + "% higher than the expected value.");
			}
	       setContentView(tv);
	   }
}
